import request from "@/utils/request"

// 获取验证码
export function getCodeImg() {
    return request({
      url: '/code',
      headers: {
        isToken: false
      },
      method: 'get',
      timeout: 20000
    })
}

// 登录方法
export function h5login(data: any) {
    return request({
      url: '/auth/h5login',
      method: 'post',
      data: data
    })
}

// 登录方法
export function login(data:any) {
  return request({
    url: '/auth/login',
    method: 'post',
    data: { username:data.userName, password: data.password, code:"", uuid:"" }
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'delete'
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: '/system/user/getInfo',
    method: 'get'
  })
}

//获取图片带域名的链接
export function getUrl(file: any) {
  return request({
    url: '/file/getUrl',
    method: 'post',
    data:file
  })
}


//跟据code获取绑定的用户列表
export function getUsersList(data: any) {
  return request({
    url: `/system/user/getUserListByCode?code=${data.code}`,
    method: 'post',
    data:{}
  })
}

//跟据openId获取绑定的客户用户列表
export function getUsersListByOpenId(data: any) {
  return request({
    url: `/system/user/getUserListByOpenId?openId=${data.openId}`,
    method: 'post',
    data:{}
  })
}

//跟据code获取OpenId
export function getOpenIdByCode(data: any) {
  return request({
    url: `/system/user/getOpenIdByCode?code=${data.code}`,
    method: 'post',
    data:{}
  })
}

export function getConfigKey(key: string) {
  return request({
    url: '/system/config/configKey/' + key,
    method: 'get'
  })
}